//
//  ApplyDoctorTableViewCell.m
//  QuickCure
//
//  Created by 凉气的Mac on 16/9/13.
//  Copyright © 2016年 haoge. All rights reserved.
//

#import "ApplyDoctorTableViewCell.h"

@implementation ApplyDoctorTableViewCell


-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{

    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        
        [self setupUI];
    }
    
    return self;
}

#pragma mark --
#pragma mark --设置界面
-(void)setupUI{

    //圆
    UIButton *rightBtn = [[UIButton alloc]init];
    
    [rightBtn setTitle:@"已就诊" forState:UIControlStateNormal];
    [rightBtn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    rightBtn.titleLabel.font = kFONT14;
    [rightBtn setBackgroundColor:[UIColor colorWithRed:0.053 green:0.755 blue:0.770 alpha:1.000]];
    
    rightBtn.layer.cornerRadius = 30;
    rightBtn.clipsToBounds = YES;
    
    [self.contentView addSubview:rightBtn];
    
    [rightBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.height.width.equalTo(60);
        make.top.equalTo(self.contentView).offset(15);
        make.bottom.equalTo(self.contentView).offset(-15);
        make.right.equalTo(self.contentView).offset(-10);
    }];
    
    self.accessoryView = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"jt"]];
    
    //中间线
    UIView *lineView = [[UIView alloc]init];
    lineView.backgroundColor = [UIColor colorWithRed:0.169 green:0.152 blue:0.600 alpha:1.000];
    
    [self.contentView addSubview:lineView];
    
    [lineView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(rightBtn);
        make.height.equalTo(@1);
        make.left.equalTo(self.contentView).offset(20);
        make.right.equalTo(rightBtn.mas_left);
    }];
    
    //就诊时间
    UILabel *timeiLaebel = [self addLabelWithString:@"就诊: 2016/6/19" topView:self.contentView];
    
    [timeiLaebel makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(rightBtn.left).offset(-20);
        make.bottom.equalTo(lineView.top).offset(-4);
    }];
    
    //病人名字
    UILabel *patientNameLabel = [self addLabelWithString:@"郑先生 感冒" topView:self.contentView];
    
    [patientNameLabel makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(lineView.left).offset(15);
        make.bottom.equalTo(timeiLaebel.bottom);
    }];

    
    //医生名字
    UILabel *doctorName = [self addLabelWithString:@"周医生 主任医生" topView:lineView];
    
    [doctorName makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(patientNameLabel.left);
        make.top.equalTo(lineView.bottom).offset(6);
    }];
    
    //医院名字
    UILabel *hospitalLaebel = [self addLabelWithString:@"上海长征医院" topView:lineView];
    
    [hospitalLaebel makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(rightBtn.left).offset(-20);
        make.bottom.equalTo(doctorName);
    }];

    
    
}

-(UILabel *)addLabelWithString:(NSString *)string topView:(UIView *)topView{

    UILabel *label = [[UILabel alloc]init];
    
    label.font = kFONT12;
    
    [self.contentView addSubview:label];
    
    label.text = string;

    return label;
}



@end

























































